home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Apple Color OneScanner SDK / Scan Image 1.0 / Headers / App.h next >
Encoding:
C/C++ Source or Header  |  1996-08-24  |  6.4 KB  |  284 lines  |  [TEXT/MPCC]

  1. /*************************************************************************************
  2. #
  3. #        App.h
  4. #
  5. #        This file contains the constants and structure definitions.
  6. #
  7. #        Author(s):     Michael Marinkovich
  8. #                    Apple Developer Technical Support
  9. #                    marink@apple.com
  10. #
  11. #        Modification History: 
  12. #
  13. #            4/3/96        MWM     Initial coding                     
  14. #
  15. #        Copyright © 1992-96 Apple Computer, Inc., All Rights Reserved
  16. #
  17. #
  18. #        You may incorporate this sample code into your applications without
  19. #        restriction, though the sample code has been provided "AS IS" and the
  20. #        responsibility for its operation is 100% yours.  However, what you are
  21. #        not permitted to do is to redistribute the source as "DSC Sample Code"
  22. #        after having made changes. If you're going to re-distribute the source,
  23. #        we require that you make it clear in the source that the code was
  24. #        descended from Apple Sample Code, but that you've made changes.
  25. #
  26. *************************************************************************************/
  27.  
  28. #include <QDOffscreen.h>
  29.  
  30.  
  31. //---------------------------------------------------------------------
  32. //
  33. //    Macros
  34. //
  35. //---------------------------------------------------------------------
  36.  
  37. #define MIN(x,y)            ( ((x)<(y)) ? (x) : (y) )
  38. #define MAX(x,y)            ( ((x)>(y)) ? (x) : (y) )
  39. #define TopLeft( r )        ( *(Point *) &(r).top )
  40. #define BotRight( r )        ( *(Point *) &(r).bottom )
  41.  
  42.  
  43. //---------------------------------------------------------------------
  44. //
  45. //    General
  46. //
  47. //---------------------------------------------------------------------
  48.  
  49. #define kMinHeap            300 * 1024
  50. #define kMinSpace            300 * 1024
  51.  
  52.  
  53. //---------------------------------------------------------------------
  54. //
  55. //    Menus
  56. //
  57. //---------------------------------------------------------------------
  58.  
  59. #define rMBarID                128
  60.  
  61. enum {
  62.      mApple                    = 128,
  63.     iAbout                    = 1,
  64.  
  65.     mFile                    = 129,
  66.     iNew                    = 1,
  67.     iOpen                    = 2,
  68.     iClose                    = 3,
  69.     iSave                    = 4,
  70.     iQuit                    = 6
  71. };
  72.  
  73.  
  74. //---------------------------------------------------------------------
  75. //
  76. //    Custom Get/Put file
  77. //
  78. //---------------------------------------------------------------------
  79.  
  80.  
  81. // file types
  82. enum {
  83.     kSignature                = 'PW91',
  84.     kAllType                = '????',
  85.     kPICTType                = 'PICT',
  86.     kJPEGType                = 'JPEG'
  87. };    
  88.  
  89. enum {
  90.     kAllGetID                = 1,
  91.     kPICTGetID                = 2,
  92.     kJPEGGetID                = 3,
  93.     kPICTPutID                = 1,
  94.     kJPEGPutID                = 2
  95. };    
  96.  
  97. #define kHeaderSize            512
  98.  
  99. #define rCustomGetPopupID    10
  100. #define rCustomPutPopupID    11
  101.  
  102.  
  103. //---------------------------------------------------------------------
  104. //
  105. //    Scanner Setup dialog
  106. //
  107. //---------------------------------------------------------------------
  108.  
  109. enum {
  110.     kSourcePopup            = 3,        // source popup
  111.     kSourceFlatbedItem        = 1,
  112.     kSourceADFItem            = 2,
  113.     kSourceTPUItem            = 3,
  114.  
  115.     kColorPopup                = 4,        // color popup
  116.     kColorFull                = 1,
  117.     kColorGrayScale            = 2,
  118.  
  119.     kResolutionPopup        = 5,        // resolution popup
  120.  
  121.     kHeightItem                = 6,        // height edit text
  122.     kWidthItem                = 7,         // width edit text
  123.  
  124.     kHalfTonePopup            = 3,        // halftone popup
  125.  
  126.     kTPUPositive            = 3,
  127.     kTPUNegative            = 4,
  128.     kTPUFilmPopup            = 6
  129. };
  130.  
  131.  
  132. //---------------------------------------------------------------------
  133. //
  134. //    Scanner App specific errors
  135. //
  136. //---------------------------------------------------------------------
  137.  
  138. #define kADFCoverOpenErr        -17073
  139. #define kADFPaperJamErr            -17074
  140. #define kADFNoPaperErr            -17075
  141.  
  142.  
  143. //---------------------------------------------------------------------
  144. //
  145. //    Window stuff
  146. //
  147. //---------------------------------------------------------------------
  148.  
  149. // doc types
  150. enum {
  151.     kDocKind                    = 94,
  152.     kDialogKind                    = 95,
  153.     kFloatKind                    = 96,
  154.     kAboutKind                    = 97
  155. };    
  156.  
  157.  
  158. #define kFudgeFactor            4        // fudge factor for boundary around window
  159. #define kTitleBarHeight            18        // title bar height
  160.  
  161. // scroll additions
  162. #define kScrollWidth            15
  163. #define kScrollDelta            16
  164.  
  165.  
  166. //---------------------------------------------------------------------
  167. //
  168. //    General resource ID's
  169. //
  170. //---------------------------------------------------------------------
  171.  
  172. #define rToolWind                129
  173.  
  174. #define rAboutPictID            3000 // about picture
  175.  
  176. // dialog ID's
  177. enum {
  178.     rErrorDlg                    = 128,
  179.     rNewScanDlg                    = 129,
  180.     rHalfToneDlg                = 130,
  181.     rTransparentDlg                = 131,
  182.     rCustomGetDlg                = 132,
  183.     rCustomPutDlg                = 133
  184. };
  185.  
  186.  
  187. //---------------------------------------------------------------------
  188. //
  189. //    Alert Error ID's
  190. //
  191. //---------------------------------------------------------------------
  192.  
  193. #define kNeedsDisplayManager    128    // ID of no Display Manager
  194.  
  195.  
  196. //---------------------------------------------------------------------
  197. //
  198. //    Custom Event Proc stuff
  199. //
  200. //---------------------------------------------------------------------
  201.  
  202. enum {
  203.     kIdleProc                    = 1,
  204.     kMenuProc                    = 2,
  205.     kInContentProc                = 3,
  206.     kInGoAwayProc                = 4,
  207.     kInZoomProc                    = 5,
  208.     kInGrowProc                    = 6,
  209.     kMUpProc                    = 7,
  210.     kKeyProc                    = 8,
  211.     kActivateProc                = 9,
  212.     kUpdateProc                    = 10
  213. };
  214.     
  215.  
  216. //---------------------------------------------------------------------
  217. //
  218. //    Typedefs
  219. //
  220. //---------------------------------------------------------------------
  221.  
  222. // event handling proc
  223. typedef void (*CustomProc)(WindowRef window, void *refCon);
  224.  
  225.  
  226. // we just use the basic events for the callback procs
  227.  
  228. struct DocRec
  229. {    
  230.     CustomProc                    idleProc;            // custom idle proc
  231.     CustomProc                    mMenuProc;            // custom menu proc
  232.     CustomProc                    inContentProc;        // custom content click Proc
  233.     CustomProc                    inGoAwayProc;        // custom inGoAway proc
  234.     CustomProc                    inZoomProc;            // custom inZoom proc
  235.     CustomProc                    inGrowProc;            // custom inGrow proc
  236.     CustomProc                    mUpProc;            // custom mouseUp proc
  237.     CustomProc                    keyProc;            // custom autoKey-keyDown proc
  238.     CustomProc                    activateProc;        // custom activate window proc
  239.     CustomProc                    updateProc;            // custom window update proc
  240.     ControlRef                    hScroll;            // horz scroll bar
  241.     ControlRef                    vScroll;            // vert scroll bar
  242.     GWorldPtr                    world;                // offscreen for pict imaging
  243.     PicHandle                    pict;                // windows picture
  244.     OSType                        fileType;            // the docs fileType
  245.     THPrint                        printer;            // apps print record - inited at window int
  246.     Boolean                        dirty;                // document needs saving
  247. };
  248.  
  249. typedef struct DocRec DocRec;
  250. typedef DocRec *DocPtr, **DocHnd;
  251.  
  252.  
  253. struct UserSettings 
  254. {
  255.     short                        inputMethod;
  256.     Fixed                        height;
  257.     Fixed                        width;
  258.     short                        compMode;
  259.     Fixed                        resolution;
  260.     short                        pixelDepth;
  261.     short                        brightness;
  262.     short                        contrast;
  263.     short                        ditherPattern;
  264.     short                        TPUFilm;
  265.     short                        TPULight;
  266.     short                        TPUVendor;
  267. };
  268.  
  269. typedef struct UserSettings UserSettings;
  270. typedef UserSettings *UserSettingsPtr, **UserSettingsHnd;
  271.  
  272.  
  273.  
  274.  
  275.  
  276.  
  277.  
  278.  
  279.  
  280.  
  281.  
  282.  
  283.  
  284.